/*

Design Pattern Automation Toolkit.
Application to create applications with emphasis on Design patterns.
And support for round trip engineering.
Copyright (C) 2004 Vineeth Neelakant. nvineeth@gmail.com

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

using System;
using System.Drawing;
using System.Windows.Forms;

namespace CodeGenUILayer
{
	/// <summary>
	/// Description of CodeGenInfoForm.
	/// </summary>
	public class CodeGenInfoForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button browseButton;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button cancelButton;
		private System.Windows.Forms.Button okButton;
		private System.Windows.Forms.TextBox pathTextBox;
		private System.Windows.Forms.GroupBox groupBox1;
		private string path;
		public CodeGenInfoForm(string lang)
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			this.label1.Text=this.label1.Text+" "+lang;
			
		}
		
		#region Windows Forms Designer generated code
		/// <summary>
		/// This method is required for Windows Forms designer support.
		/// Do not change the method contents inside the source code editor. The Forms designer might
		/// not be able to load this method if it was changed manually.
		/// </summary>
		private void InitializeComponent() {
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.browseButton = new System.Windows.Forms.Button();
			this.pathTextBox = new System.Windows.Forms.TextBox();
			this.okButton = new System.Windows.Forms.Button();
			this.cancelButton = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.BackColor = System.Drawing.SystemColors.ControlLight;
			this.groupBox1.Controls.Add(this.browseButton);
			this.groupBox1.Controls.Add(this.pathTextBox);
			this.groupBox1.ForeColor = System.Drawing.Color.MediumBlue;
			this.groupBox1.Location = new System.Drawing.Point(8, 37);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(560, 97);
			this.groupBox1.TabIndex = 1;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Select the folder to generate the code, For each componenet in the project, corre" +
				"sponding sub-folder will be created, and the code for the respective classes wil" +
				"l be created there";
			// 
			// browseButton
			// 
			this.browseButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.browseButton.Location = new System.Drawing.Point(456, 52);
			this.browseButton.Name = "browseButton";
			this.browseButton.Size = new System.Drawing.Size(75, 21);
			this.browseButton.TabIndex = 1;
			this.browseButton.Text = "browse";
			this.browseButton.Click += new System.EventHandler(this.BrowseButtonClick);
			// 
			// pathTextBox
			// 
			this.pathTextBox.Location = new System.Drawing.Point(24, 52);
			this.pathTextBox.Name = "pathTextBox";
			this.pathTextBox.Size = new System.Drawing.Size(392, 20);
			this.pathTextBox.TabIndex = 0;
			this.pathTextBox.Text = "";
			// 
			// okButton
			// 
			this.okButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.okButton.Location = new System.Drawing.Point(304, 141);
			this.okButton.Name = "okButton";
			this.okButton.Size = new System.Drawing.Size(75, 21);
			this.okButton.TabIndex = 2;
			this.okButton.Text = "&OK";
			this.okButton.Click += new System.EventHandler(this.OkButtonClick);
			// 
			// cancelButton
			// 
			this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.cancelButton.Location = new System.Drawing.Point(408, 141);
			this.cancelButton.Name = "cancelButton";
			this.cancelButton.Size = new System.Drawing.Size(136, 21);
			this.cancelButton.TabIndex = 3;
			this.cancelButton.Text = "cancel code generation";
			// 
			// label1
			// 
			this.label1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.label1.Dock = System.Windows.Forms.DockStyle.Top;
			this.label1.Font = new System.Drawing.Font("Times New Roman", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
			this.label1.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
			this.label1.Location = new System.Drawing.Point(0, 0);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(592, 24);
			this.label1.TabIndex = 0;
			this.label1.Text = "You have selected the Code generator for the language";
			// 
			// CodeGenInfoForm
			// 
			this.AcceptButton = this.okButton;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.CancelButton = this.cancelButton;
			this.ClientSize = new System.Drawing.Size(592, 176);
			this.Controls.Add(this.cancelButton);
			this.Controls.Add(this.okButton);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.label1);
			this.Name = "CodeGenInfoForm";
			this.Text = "Code Generation Details";
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion
		
		
		void OkButtonClick(object sender, System.EventArgs e)
		{
			if(this.pathTextBox.Text==null || this.pathTextBox.Text.Length==0)
			{
				MessageBox.Show("Please enter a path","Error");
				return;
			}
			else
			{
				this.path=this.pathTextBox.Text;
				this.Close();
				this.DialogResult=DialogResult.OK;
			}
			
				
		}
		public string Path
		{
			get
			{
				return this.path;	
			}
		}
		
		void BrowseButtonClick(object sender, System.EventArgs e)
		{
			FolderBrowserDialog dialog = new FolderBrowserDialog();
			dialog.ShowDialog();
			this.pathTextBox.Text=dialog.SelectedPath;
		}
		
	}
}
